package cn.ssm.pojo;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * 排片表
 * 
 * @author 朱海松
 *
 */
public class Schedule {
	private int id;// 排片编号
	private int movieId;// 电影编号
	private int hallId;// 影厅编号
	private Double price;// unsigned单价
	private Date showTime;// 放映时间

	// 新增属性 黄少涛
	private String movieName;// 电影名称
	private int duration; // 电影时长
	private String description; // 影厅描述
	private String poster; //电影海报
	private String overTime;// 电影结束时间 get方法写了方法 通过放映时间加上电影时长
	
	//新增属性 艾辉
	private String movieTypeName;	//影片类型
	private Movie movie;			//电影类
	private Hall hall;				//影厅类
	
	
	
	
	public String getPoster() {
		return poster;
	}

	public void setPoster(String poster) {
		this.poster = poster;
	}

	public String getMovieTypeName() {
		return movieTypeName;
	}

	public void setMovieTypeName(String movieTypeName) {
		this.movieTypeName = movieTypeName;
	}

	public Movie getMovie() {
		return movie;
	}

	public void setMovie(Movie movie) {
		this.movie = movie;
	}

	public Hall getHall() {
		return hall;
	}

	public void setHall(Hall hall) {
		this.hall = hall;
	}

	public Schedule() {

	}

	public Schedule(int id, int movieId, int hallId, Double price, Date showTime) {
		super();
		this.id = id;
		this.movieId = movieId;
		this.hallId = hallId;
		this.price = price;
		this.showTime = showTime;
	}

	public String getOverTime() throws ParseException {
		if (showTime != null) {
			DateFormat df3 = DateFormat.getTimeInstance();// 只显示出时分秒
			String format = df3.format(showTime);// 把电影放映时间只显示时分秒并转成字符串
			SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); // 把某个时间增加一段时间
			Calendar nowTime1 = Calendar.getInstance();
			Date date1 = sdf.parse(format);// 把字符串转换成时间类型
			nowTime1.setTime(date1);
			nowTime1.add(Calendar.MINUTE, duration);// 要增加什么，在这里写
			String overTime = sdf.format(nowTime1.getTime());
		}
		return overTime;

	}

	public void setOverTime(String overTime) {
		this.overTime = overTime;
	}

	public String getMovieName() {
		return movieName;
	}

	public void setMovieName(String movieName) {
		this.movieName = movieName;
	}

	public int getDuration() {
		return duration;
	}

	public void setDuration(int duration) {
		this.duration = duration;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getMovieId() {
		return movieId;
	}

	public void setMovieId(int movieId) {
		this.movieId = movieId;
	}

	public int getHallId() {
		return hallId;
	}

	public void setHallId(int hallId) {
		this.hallId = hallId;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Date getShowTime() {
		return showTime;
	}

	public void setShowTime(Date showTime) {
		this.showTime = showTime;
	}

	@Override
	public String toString() {
		return "Schedule [id=" + id + ", movieId=" + movieId + ", hallId=" + hallId + ", price=" + price + ", showTime="
				+ showTime + "]";
	}

}
